using UniversalAdminSystem.Application.Common.Results;
using UniversalAdminSystem.Application.UserManagement.Dtos;

namespace UniversalAdminSystem.Application.UserManagement.Interface;

/// <summary>
/// 用户管理应用服务接口
/// 提供用户的基本CRUD操作和权限管理功能
/// </summary>
public interface IUserManagementAppService
{
    /// <summary>
    /// 获取所有用户列表
    /// </summary>
    /// <returns>用户列表</returns>
    Task<Result<IEnumerable<UserDto>>> GetUsersAsync();

    /// <summary>
    /// 创建新用户
    /// </summary>
    /// <param name="createDto">用户创建数据传输对象</param>
    /// <returns>创建的用户信息</returns>
    Task<Result<UserDto>> CreateUserAsync(UserCreateDto createDto);

    /// <summary>
    /// 删除用户
    /// </summary>
    /// <param name="id">用户ID</param>
    /// <returns>删除操作结果</returns>
    Task<Result> DeleteUserAsync(Guid id);

    /// <summary>
    /// 获取用户详情
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>用户详情</returns>
    Task<Result<UserDetailDto>> GetUserByIdAsync(Guid userId);

    /// <summary>
    /// 更新用户信息
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="updateDto">用户更新数据传输对象</param>
    /// <returns>更新操作结果</returns>
    Task<Result> UpdateUserAsync(Guid userId, UserUpdateDto updateDto);

    /// <summary>
    /// 为用户分配角色
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="roleIds">角色ID列表</param>
    /// <returns>分配操作结果</returns>
    Task<Result> AssignRoleAsync(Guid userId, List<Guid> roleIds);

    /// <summary>
    /// 移除用户角色
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="roleId">角色ID</param>
    /// <returns>移除操作结果</returns>
    Task<Result> RemoveRoleAsync(Guid userId, Guid roleId);

    /// <summary>
    /// 获取用户的所有权限
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <returns>权限编码列表</returns>
    Task<Result<IEnumerable<string>>> GetUserPermissionsAsync(Guid userId);

    /// <summary>
    /// 检查用户是否有指定权限
    /// </summary>
    /// <param name="userId">用户ID</param>
    /// <param name="permissionCode">权限编码</param>
    /// <returns>是否有权限</returns>
    Task<Result<bool>> CheckUserPermissionAsync(Guid userId, string permissionCode);
}